package com.plantplaces.ui;

import com.example.fs131046plantplaces.R;

import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

public class PlantPlacesActivity extends Activity {

	public static final String PLANT_ID = "PLANT_ID";

	public PlantPlacesActivity() {
		super();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// get a reference to a menu inflater
		MenuInflater menuInflater = getMenuInflater();
		// inflate the XML menu.
		menuInflater.inflate(R.menu.plantplacesmenu, menu);
		// satisfy the return.
		return true;
	
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch(item.getItemId()) {
		case R.id.gpsAPlant:
			invokeGPSAPlant();
			break;
		case R.id.advancedSearch:
			invokeAdvanceSearch();
			break;
		case R.id.mnuPreferences:
			invokeSettings();
			break;
		}		
		return true;
	}

	private void invokeSettings() {
		// invoke the settings screen.
		Intent settingsIntent = new Intent(this, PlantPlacesPreferencesActivity.class);
		startActivity(settingsIntent);
	}

	private void invokeAdvanceSearch() {
		// TODO Auto-generated method stub
		Intent advancedSearchIntent = new Intent(this, AdvancedSearchActivity.class);
		startActivity(advancedSearchIntent);
	}

	private void invokeGPSAPlant() {
		// TODO Auto-generated method stub
		Intent gpsIntent = new Intent(this, LocationFinder.class);
		startActivity(gpsIntent);
	}

}